package design.agent;

import java.util.Random;

/**
 * \* User: Administrator
 * <p>
 * \* Date: 2020/9/22
 * <p>
 * \* Time: 10:24
 * <p>
 * \* Description:
 * \
 */
public class Sale {
    public void sellIBMComputer(int number) {
        Stock stock = new Stock();
        Purchase purchase = new Purchase();
        if (stock.getStockNumber() < number) {
            purchase.buyIBMcomputer(number);
        }
        System.out.println("销售：" + number + "台");
        stock.decrease(number);
    }

    public void offSale() {
        Stock stock = new Stock();
        System.out.println("折价销售" + stock.getStockNumber() + "台");
    }

    public int getSaleStatus() {
        Random random = new Random(System.currentTimeMillis());
        int i = random.nextInt(100);
        System.out.println("销售情况：" + i);
        return i;
    }
}
